<?php
/* @var $this KabupatenController */
/* @var $model Kabupaten */
/* @var $form CActiveForm */
global $region_wilayah;
?>
<div class="form">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'kabupaten-form',
        'enableAjaxValidation' => false,));
    ?>
    <?php echo $form->errorSummary($model); ?>
    <table border="0" cellpadding="0" cellspacing="0" id="id-form">
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('nama_kabupaten'); ?></th>
            <td class="idform">
                <?php echo $form->textField($model, 'nama_kabupaten', array('size' => 60, 'maxlength' => 250)); ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('nama_kabupaten')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'nama_kabupaten', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('kode_lokasi'); ?></th>
            <td class="idform">
                <?php
                echo $form->dropDownList($model, 'kode_lokasi', $region_wilayah, array(
                    'empty' => '(Pilih wilayah)',
                    'style' => 'width:300px',));
                ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('kode_lokasi')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'kode_lokasi', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <tr>
            <th valign="top"><?php echo $model->getAttributeLabel('jadwal_kegiatan'); ?></th>
            <td class="idform">
                <?php
                $this->widget('ext.tinymce.TinyMce', array(
                    'model' => $model,
                    'attribute' => 'jadwal_kegiatan',
                    'fileManager' => array(
                        'class' => 'ext.elFinder.TinyMceElFinder',
                        'connectorRoute' => 'elfinder/connector',),
                    'htmlOptions' => array('rows' => 6, 'cols' => 60,),));
                ?>
            </td>
            <td class="idform">
                <?php if ($model->hasErrors('jadwal_kegiatan')) echo "<div class='error-left'></div>"; ?>
                <?php echo $form->error($model, 'jadwal_kegiatan', array('class' => 'error-inner')); ?>
            </td>
        </tr>
        <? if (!$model->isNewRecord) : ?>
            <tr>
                <th>&nbsp;</th>
                <td valign="top">
                    <?php
                    echo l('Tambah Pengurus', url('kabupatenanggota/create', array('id' => $model->id_kabupaten)));
                    $this->widget('zii.widgets.grid.CGridView', array(
                        'id' => 'kabupaten-anggota-grid',
                        'dataProvider' => $model_anggota->search(),
                        'columns' => array(
                            array(
                                'header' => 'Laskar',
                                'name' => 'laskar_',
                                'type' => 'raw',
                                'value' => '$data->idLaskar->nama'
                            ),
                            // 'jabatan',
                            array(
                                'header' => 'Jabatan',
                                'name' => 'jabatan',
                                'type' => 'raw',
                                'value' => 'u::getPengurusKabupaten($data["jabatan"])'
                            ),
                            //  array(
//                        'header' => 'Action',
//                        'name' => 'edit',
//                        'type' => 'html',
//                        'value' => 'l(img(bu()."/img/update.png"),url("kabupatenanggota/update",array("id" => $data->id_anggota)))'
//                    ),
                            array
                                (
                                'class' => 'CButtonColumn',
                                'template' => ' {update}   {delete}',
                                'buttons' => array
                                    (
                                    'update' => array
                                        (
                                        'label' => 'update',
                                        'imageUrl' => bu() . '/img/update.png',
                                        'url' => 'Yii::app()->createUrl("kabupatenanggota/update", array("id"=>$data->id_anggota))',
                                    ),
                                    'delete' => array
                                        (
                                        'label' => 'hapus',
                                        'imageUrl' => bu() . '/img/delete.png',
                                        'url' => 'Yii::app()->createUrl("kabupatenanggota/delete", array("id"=>$data->id_anggota))',
                                    ),
                                ),
                            ),
                        ),
                    ));
                    ?>
                </td>
                <td class="idform"></td>
            </tr>
        <? endif; ?>
        <tr>
            <th>&nbsp;</th>
            <td valign="top">
                <?php echo CHtml::submitButton($model->isNewRecord ? 'Buat' : 'Simpan', array('class' => 'form-submit')); ?>
            </td>
            <td class="idform"></td>
        </tr>
    </table>
    <?php $this->endWidget(); ?>
</div><!-- form -->